import QAstNode from '../model/QAstNode'

let jsonCode = '{"name":"haha"}'

const leftCurlyBrace = /{/

const ast: QAstNode = new QAstNode('root')
const rootChild = ast.child

function parse(code) {
  const attr = code.match(leftCurlyBrace)
  if (attr){
    rootChild.push(new QAstNode(attr[0]))
  }
  console.log(jsonCode)
  console.log(attr)
  jsonCode = jsonCode.substring(attr.length)
  console.log(jsonCode)
}

parse(jsonCode)

console.log(ast)
